import { Eventable } from "./Eventable.js";

export class CommandPanel extends Eventable {
    #restart: JQuery;
    #pause: JQuery;
    #built: boolean = false;

    constructor(restart: JQuery | string, pause: JQuery | string) {
        super();
        this.#restart = $(restart as any);
        this.#pause = $(pause as any);
        this.build();
    }

    build(): this {
        if (!this.#built) {
            this.internalBuild();
        }
        return this;
    }

    internalBuild(): void {
        this.#built = true;
        this.#restart.on("click", () => this.trigger("restart"));
        this.#pause.on("click", () => this.trigger("pause"));
    }
}
